Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bundle size test after webpack 5 update #10502

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

curtisman
Copy link
Member

@curtisman curtisman commented Jun 2, 2022

PR #10186 upgraded to webpack 5, which caused the output of the bundle-size-test to be all 23 bytes with all export removed.

See #10186 (comment)

Adding output.library in the webpack config fixes the issue.

@curtisman curtisman requested a review from a team as a code owner June 2, 2022 01:11
@github-actions github-actions bot added the area: examples Changes that focus on our examples label Jun 2, 2022
@github-actions github-actions bot added the base: main PRs targeted against main branch label Jun 2, 2022
@curtisman curtisman requested a review from scottn12 June 2, 2022 01:12
@curtisman curtisman changed the title Fix Bundle size test after webpack 5 update Fix bundle size test after webpack 5 update Jun 2, 2022
@msfluid-bot
Copy link
Collaborator

@fluid-example/bundle-size-tests: +1.16 MB
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 23 Bytes 356.08 KB +356.06 KB
connectionState.js 23 Bytes 625 Bytes +602 Bytes
containerRuntime.js 23 Bytes 175.95 KB +175.93 KB
loader.js 23 Bytes 146.05 KB +146.03 KB
map.js 23 Bytes 37.49 KB +37.46 KB
matrix.js 23 Bytes 121.17 KB +121.15 KB
odspDriver.js 23 Bytes 144.91 KB +144.88 KB
odspPrefetchSnapshot.js 23 Bytes 36.8 KB +36.78 KB
sharedString.js 23 Bytes 137.82 KB +137.79 KB
Total Size 207 Bytes 1.16 MB +1.16 MB

Baseline commit: c32854f

Generated by 🚫 dangerJS against 9a3e7f4

Copy link
Member

@tylerbutler tylerbutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@CraigMacomber
Copy link
Contributor

Is it practical to make this test fail if it's clearly not working in this way? Maybe check the bundle is valid/works, or check for a minimum size?

@curtisman
Copy link
Member Author

curtisman commented Jun 2, 2022

@CraigMacomber yeah, I was thinking about telemetry and alert would be good, but your suggestion to just failed the test is great if the size is under certain limit. Let me make a follow up PR.

@curtisman curtisman merged commit 13ebe46 into microsoft:main Jun 2, 2022
@curtisman curtisman deleted the bundle branch June 2, 2022 14:06
curtisman added a commit that referenced this pull request Jun 2, 2022
Follow up to PR #10502, where we broke the bundle size test.

This change updates the tools to include some sanity check by processing the generated stats file and error if the asset size being tested is smaller than certain threshold (currently set at 100 bytes).

Note that the build tool package will need to be published and updated in the core packages mono repo before this will take effect.

Example output of the tool if the fix for #10502 is removed:
```
found bundleAnalysis for @fluid-example/bundle-size-tests
@fluid-example/bundle-size-tests: asset aqueduct.js (23) is too small
@fluid-example/bundle-size-tests: asset connectionState.js (23) is too small
@fluid-example/bundle-size-tests: asset containerRuntime.js (23) is too small
@fluid-example/bundle-size-tests: asset loader.js (23) is too small
@fluid-example/bundle-size-tests: asset map.js (23) is too small
@fluid-example/bundle-size-tests: asset matrix.js (23) is too small
@fluid-example/bundle-size-tests: asset odspDriver.js (23) is too small
@fluid-example/bundle-size-tests: asset odspPrefetchSnapshot.js (23) is too small
@fluid-example/bundle-size-tests: asset sharedString.js (23) is too small
Error: Found assets are too small (<100 bytes). Webpack bundle analysis is probably not correct.
```
@tylerbutler tylerbutler mentioned this pull request Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: examples Changes that focus on our examples base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants